/**
 * 
 */
package com.quiz.activity.questions;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;


/**
 *
 * @author Brian Boyle
 * Apr 12, 2012
 */
public class NextQuestionClickListener implements OnClickListener {

    private Context context;
    private int questionCount;
    private long sectionId;
    private int dialogToDismiss;
    private int correctQuestionCount;


    public NextQuestionClickListener(Context context, int questionCount, long sectionId, int dialogToDismiss, int correctQuestionCount) {
        this.context = context;
        this.questionCount = questionCount;
        this.sectionId = sectionId;
        this.dialogToDismiss = dialogToDismiss;
        this.correctQuestionCount = correctQuestionCount;
    }

    /**
     * {@inheritDoc}
     */
    public void onClick(View v) {
        Intent nextQuestionIntent = new Intent(this.context, QuestionActivity.class);
        nextQuestionIntent.putExtra("sectionId", this.sectionId);
        nextQuestionIntent.putExtra("questionCount", this.questionCount);
        nextQuestionIntent.putExtra("correctQuestionCount", this.correctQuestionCount);
        QuestionActivity c = (QuestionActivity) context;
        c.dismissDialog(dialogToDismiss);

        //Don't log history for the QuestionActivity
        nextQuestionIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
        this.context.startActivity(nextQuestionIntent);
    }

}
